<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8"
         contentType="text/html;charset=utf-8" %>
<%@ include file="/common/taglibs.jsp" %>
<s:action name="user!view" var="view" executeResult="false"/>
<head>
    <title>个人中心信息修改</title>
</head>
<div id="wrapper">

    <%@ include file="/include/left.jsp" %>

    <div id="page-wrapper" class="gray-bg">


        <div class="row wrapper border-bottom white-bg page-heading">
            <div class="col-lg-10">
                <h2>修改资料</h2>
                <ol class="breadcrumb">
                    <li>
                        <a href="${ctx}">首页</a>
                    </li>
                    <li>
                        <a>新闻</a>
                    </li>
                    <li class="active">
                        <strong>修改个人资料</strong>
                    </li>
                </ol>
            </div>
        </div>


        <div class="wrapper wrapper-content">
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>修改资料</h5>
                        </div>
                        <div class="ibox-content">
                            <s:form id="userForm" action="user!update.action" method="post" cssClass="form-horizontal"
                                    namespace="">
                                <input type="hidden" name="redirect" value="/user/view"/>
                                <input type="hidden" name="id" value="${view.user.id}"/>

                                <div class="form-group"><label class="col-sm-2 control-label">上传用户头像</label>
                                    <div class="col-sm-10">
                                        <div class="m-upimgview">
                                            <img src="${view.user.photo}" id="preview-img">
                                            <input id="upimg" type="hidden" name="user.photo"
                                                   value="${view.user.photo}">
                                            <input id="fileupload" name="file" class="hidden" type="file"/>

                                            <div class="progress progress-mini">
                                                <div style="" id="progress" class="progress-bar"></div>
                                            </div>
                                        </div>

                                        <a class="btn btn-primary" href="javascript:;" onclick="fileUp('preview-img','upimg','progress','fileupload');">选择一个文件</a>
                                    </div>
                                </div>

                                <div class="form-group"><label class="col-sm-2 control-label">账号</label>
                                    <div class="col-sm-6">
                                        <input type="text" name="user.username" value="${view.user.username}"  readonly class="form-control  validate[required]">
                                    </div>
                                </div>

                                <div class="form-group"><label class="col-sm-2 control-label">昵称</label>
                                    <div class="col-sm-6">
                                        <input type="text"  name="user.nickname" value="${view.user.nickname}"  class="form-control  validate[required]">
                                    </div>
                                </div>

                                <div class="form-group"><label class="col-sm-2 control-label">姓名</label>
                                    <div class="col-sm-6">
                                        <input type="text"  value="${view.user.realname}" name="user.realname"  class="form-control  validate[required]">
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">性别</label>
                                    <div class="col-sm-6">
                                        <div class="i-checks">
                                            <label>
                                                <input type="radio" checked="" <c:if test="${view.user.male==true}">checked="checked"</c:if>
                                                       value="true" name="user.male">
                                                男
                                            </label>
                                        </div>
                                        <div class="i-checks">
                                            <label>
                                                <input type="radio"  <c:if test="${view.user.male==false}">checked="checked" </c:if>
                                                       value="false" name="user.male">
                                                女
                                            </label>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group"><label class="col-sm-2 control-label">生日</label>
                                    <div class="col-sm-6">
                                        <input type="text" name="user.birthday"
                                               value="${view.user.birthday}" class="form-control  validate[required]">
                                    </div>
                                </div>

                                <div class="form-group"><label class="col-sm-2 control-label">邮箱</label>
                                    <div class="col-sm-6">
                                        <input type="text" name="user.email" value="${view.user.email}"  class="form-control  validate[required] validate[custom[email]]">
                                    </div>
                                </div>

                                <div class="form-group"><label class="col-sm-2 control-label">简介</label>
                                    <div class="col-sm-10">
                                        <textarea class="form-control diff-textarea" name="user.intro"  rows="6">${view.user.intro}</textarea>
                                    </div>
                                </div>




                                <div class="hr-line-dashed"></div>
                                <div class="form-group">
                                    <div class="col-sm-4 col-sm-offset-2">
                                        <button class="btn btn-white" type="button" onclick="javascript:history.back()">取消</button>
                                        <button class="btn btn-primary" type="submit">保存</button>
                                    </div>
                                </div>
                            </s:form>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <%@ include file="/common/footer.jsp" %>
    </div>

</div>

<%@ include file="/common/scripts.jsp" %>
<%@ include file="/common/validate.jsp" %>
<%@ include file="/common/icheck.jsp" %>
<%@ include file="/common/script/fileupload.jsp" %>
<%@ include file="/common/script/cxcalendar.jsp" %>

<script>
    $('#userForm').validationEngine({promptPosition:'topLeft'});

    $(document).ready(function(){
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green',
        });

    });


    <%--$(function () {--%>
        <%--'use strict';--%>
        <%--var url = 'http://up.qiniu.com/';--%>

        <%--$('#fileupload').fileupload({--%>
            <%--url: url,--%>
            <%--dataType: 'json',--%>
            <%--post: 'POST',--%>
            <%--formData: {--%>
<%--//                key: key,--%>
                <%--token: "<%=cn.org.eshow.component.qiniu.QiniuUtil.uploadToken("eshow")%>"--%>
            <%--},--%>
            <%--done: function (e, data) {--%>
                <%--$("#preview-img").attr("src","http://eshow.u.qiniudn.com/" + data.result.key);--%>
                <%--$("#upimg").val("http://eshow.u.qiniudn.com/" + data.result.key);--%>
            <%--},--%>
            <%--progressall: function (e, data) {--%>
                <%--var progress = parseInt(data.loaded / data.total * 100, 10);--%>
                <%--$('#progress').html(progress + '%');--%>
            <%--}--%>
        <%--}).prop('disabled', !$.support.fileInput)--%>
                <%--.parent().addClass($.support.fileInput ? undefined : 'disabled');--%>
    <%--});--%>


</script>





</body>

